package com.example.mountainwalker.mapper;


import com.example.mountainwalker.entity.StrategyFavoriteInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface StrategyFavoriteMapper {

    @Select("select * from mw.strategyfavorite")
    List<StrategyFavoriteInfo> getStrategyFavoriteInfo();

    @Select("select * from mw.strategyfavorite where StrategyFavoriteID= #{StrategyFavoriteID}")
    StrategyFavoriteInfo getStrategyFavoriteInfoById(Integer StrategyFavoriteID);

    @Delete("delete from mw.strategyfavorite where StrategyFavoriteID= #{StrategyFavoriteID}")
    int deleteStrategyFavoriteInfoById(Integer StrategyFavoriteID);

    @Insert("insert into mw.strategyfavorite (UserID,StrategyID,FavoriteTime) " +
            "values(#{UserID}, #{StrategyID}, #{FavoriteTime})")
    int insertStrategyFavoriteInfo(StrategyFavoriteInfo strategyFavoriteInfo);

    @Update("update mw.strategyfavorite set " +
            "UserID=#{UserID}, " +
            "StrategyID=#{StrategyID}, " +
            "FavoriteTime=#{FavoriteTime} "+
            "WHERE StrategyFavoriteID=#{StrategyFavoriteID}")
    int updateStrategyFavoriteInfo(StrategyFavoriteInfo strategyFavoriteInfo);

}
